var express = require('express');
var router = express.Router();
var util = require('util');
var fs = require('node-fs');
var EventProxy = require('eventproxy');
var path = require('path');
var xlsx = require('node-xlsx');

var CONSTS = require('../consts');
//var User = require('../models/User');
var logger = require('../models/logger');
var resultJson = require('../result-json');
var downloadHelper = require('../utils/downloadHelper');
var timeoutHelper = require('../utils/timeoutHelper');
var fileHelper = require('../utils/fileHelper');

router.post('/upload', function(req, res, next) {
	downloadHelper.upload(req, function(json) {
		res.send(json);
	});
});

router.post('/delete', function(req, res, next) {
	fileHelper.delete(req.body.url);
	res.send(resultJson(0));
});

router.get('/', function(req, res, next) {
	res.redirect('./admin/dist/index.html#/login');
});

router.get('/admin/', function(req, res, next) {
	res.redirect('./dist/signup.html');
});


module.exports = router;